<?php
    set_time_limit(0);
    define('APP', TRUE);
    include('modules/loader.php'); 
    include('plugins/baidu_bar.php');
	
	
	//echo get_ext('http://image.seowhy.com/common/slogan/20140209.png');
	
	//$obj = new baidu_bar();
	$arr = array(
				'http:\/\/h.hiphotos.bdimg.com\/album\/s%3D900%3Bq%3D90\/sign=bebf4f90b151f819f5250f4aea8f3bd0\/37d12f2eb9389b50c86f29e98435e5dde6116efd.jpg');
	//foreach($arr as $u){
	//	echo $obj->save_pic($u,'/upload/');
	//}
	//echo $obj->save_pic('http://120.img.pp.sohu.com/images/blog/2008/1/27/18/3/11857df8529.jpg','/upload/');
	//print_r(basename("http://a.hiphotos.bdimg.com/album/w%3D2048%3Bq%3D90/sign=c510d16973f082022d92963f7fc3c09c/9213b07eca806538648c915997dda144ad348211.jpg"));
	//header("Content-Type: image/jpeg");
	//readfile("http://a.hiphotos.bdimg.com/album/w%3D2048%3Bq%3D90/sign=c510d16973f082022d92963f7fc3c09c/9213b07eca806538648c915997dda144ad348211.jpg");
		
	// pic list
	//exit();
	$html = file_get_contents('http://image.baidu.com/detail/newindex?col=%E7%BE%8E%E5%A5%B3&tag=%E5%85%A8%E9%83%A8&pn=5&pid=11642540103&aid=401461718&user_id=62593895&setid=48977&sort=0&newsPn=&fr=&from=1');
	
	//echo $html;
	
	preg_match_all('/albumData(.*)script/is', $html, $out);
	$html_list = $out[0][0];
	//echo $html_list;

	preg_match_all('/imageUrl".*"(.*)"/isU',$html_list,$list);
	print_r($list);
exit();
echo '<br> doing ....<br>';
	
	foreach($list[1] as $url){
		$url= str_replace('\\', '', $url);
		echo $url."<br>";
		//sleep(3);	
		echo $obj->save_pic($url,'/upload/');
	}

/*
$key = 's8j6l0s4';
$input = 'mtIbx6joOSH/5nX0jO6KjLWlQVucMSm0kBX2DvRUL5g6wnuud44jTPei9Z6oFArXkUQJEa4GC2cCYBT9PHj2Cyb2HLPniaqjcbhuhY3i7H0=';
function en($key,$str){
    $td = mcrypt_module_open(MCRYPT_DES,'',MCRYPT_MODE_ECB,'');
    $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_DES,MCRYPT_MODE_ECB), MCRYPT_RAND);
    mcrypt_generic_init($td, $key,$iv);
    $en_data = mcrypt_generic($td, $str);
    mcrypt_module_close($td);
    return base64_encode($en_data);
}
////$en_data = en($key,$input);
//echo $en_data.'<br>';


function de($key,$en_data){
    $str = base64_decode($en_data);

    $td = mcrypt_module_open(MCRYPT_DES,'',MCRYPT_MODE_ECB,'');
    $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_DES,MCRYPT_MODE_ECB), MCRYPT_RAND);
    mcrypt_generic_init($td, $key, $iv);
    $de_data = mdecrypt_generic($td,$str);
    return $de_data;
}

$url = 'http://113.11.202.84/quotes/ZhjDS.txt?'.time();
$en_data = file_get_contents($url);
echo de($key, $en_data);
*/
?>